<% content_for :content do %>
<%= javascript_include_tag 'livevalidation' %>
<%= javascript_include_tag 'validationFunctions' %>
<%= stylesheet_link_tag 'live_validation' %>

<h3>Nowy użytkownik</h3>  
  
<div class="depot-form">
	<%= error_messages_for :user %>
	<fieldset style="border: none; margin-left: -5px;">
		<legend>Enter User Details</legend>
		<% form_for(@user) do |f| %>
			<p>
			<label for="user_name">Login:</label>
			<%= f.text_field :login, :size => 40 %>
			</p>
			<SCRIPT>addPresenceValidation('user_login')</SCRIPT>
			<p>
			<label for="user_password">Hasło:</label>
			<%= f.password_field :PASSWORD, :size => 40 %>
			</p>
			<p>
			<label for="user_password_confirmation">Powtórz hasło:</label>
			<%= f.password_field :password_confirmation, :size => 40 %>
			</p>
			<SCRIPT>
				var f19 = new LiveValidation('user_password_confirmation',{validMessage: " "});
				f19.add( Validate.Confirmation, { match: 'user_PASSWORD',failureMessage:" "} );
			</SCRIPT>	
			<p>
			<label for="user_email">Email:</label>
			<%= f.text_field :email, :size => 40 %>
			</p>	
			<p>
			<label for="user_pesel">Numer PESEL:</label>
			<%= f.text_field :pesel, :size => 40 %>
			</p>
			
			<p>
			<label for="user_role_id">Rola w systemie:</label>	
			<%=
		#			@systemRoles = SystemRole.find(:all, :order => "NAME").map {|u| [u.name, u.id] }
					f.select( :roleID,@systemRoles,:size=>40 )
					
			%>
			</p>
				
			<p>
			<label for="user_position_id">Pozycja:</label>	
			<%=
	#				@positions = Position.find(:all, :order => "NAME").map {|u| [u.name, u.id] }
					f.select( :positionID,@positions,{},{:onchange => "if_student()"}) 
		#			f.select( :positionID,@positions,{},{:onchange => remote_function(
		#			:url => {:action => :add_study_period}
		#			)}) 
					
		
			%>
			</p>		
		
			<p>
			<label for="user_study_period">Rocznik:</label>	
			<%=
					f.select( :study_period,@years.sort,{},{:disabled=>"disabled"})
	
			%>
			</p>
			
			<p>
			<label for="user_expiry_date">Termin wygaśnięcia konta:</label>	
				<%= f.datetime_select(:expiry_date,:default => 2.week.from_now) %>
			</p>
			<p>
                        <br/>
			<%= f.submit "Utwórz użytkownika", :class => "submit" %>
			</p>
		
		
		<% end %>
	</fieldset>
</div>
<% end %>